import { useRoutes, RouteObject, Navigate } from 'react-router-dom'
// import { Home } from '../views/home'
import { Update } from '../views/update'
import { lazy } from 'react'

const Home = lazy(
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
  // @ts-ignore
  () => import(/* webpackChunkName: "home" */ '../views/home')
)

const router: RouteObject[] = [
  {
    path: '/',
    element: <Navigate to="/home" />
  },
  {
    path: '/home',
    element: <Home />
  },
  {
    path: '/update',
    element: <Update />
  }
]

// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
export const RenderRoute = () => {
  return useRoutes(router)
}
